#!/bin/bash

. $OPENARS_HOME/common/debug.h
. $OPENARS_HOME/common/functions.h

[ -z "$USER_ARS" ] && USER_ARS=$LOGNAME

srvlist=`get_hosts --os=Unix --control=YES`
INF "count hosts: `echo $srvlist | wc -w`"

for server in $srvlist
do
if [ ! -z "$USER_ARS" ]; then
    ( SSH $USER_ARS@$server "true"; [ "$?" -ne 0 ] && ERR "Error $USER_ARS key in server $server" ) &
fi
if [ ! -z "$USER_ZABBIX" -a "$USER_ARS" != "$USER_ZABBIX" ]; then
    ( SSH $USER_ZABBIX@$server "true"; [ "$?" -ne 0 ] && ERR "Error $USER_ZABBIX key in server $server" ) &
fi
done

WAIT 180

exit 0
